package com.zhentao.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhentao.model.common.dtos.PageResponseResult;
import com.zhentao.model.common.dtos.ResponseResult;
import com.zhentao.model.common.manger.dto.FriendDto;
import com.zhentao.model.common.manger.pojo.Activity;
import com.zhentao.model.common.manger.pojo.Friend;
import com.zhentao.model.common.manger.vo.UserFriendsVo;
import com.zhentao.service.FriendService;
import com.zhentao.mapper.FriendMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
* @author lenovo
* @description 针对表【friend】的数据库操作Service实现
* @createDate 2024-10-06 23:04:18
*/
@Service
public class FriendServiceImpl extends ServiceImpl<FriendMapper, Friend>
    implements FriendService{
    @Resource
    private FriendMapper friendMapper;

    @Override
    public ResponseResult findAll(FriendDto dto) {
        List<UserFriendsVo> all = friendMapper.findUserAndFriend(dto);
//        Page<Friend> page=new Page<>(dto.getPage(),dto.getSize());
//        page= friendMapper.selectPage(page,);
//        ResponseResult pageResponseResult = new PageResponseResult(dto.getPage(), dto.getSize(), (int) page.getTotal());
//        pageResponseResult.setData(page.getRecords());
        return ResponseResult.okResult(all);
    }

    @Override
    public ResponseResult auditSuccess(Integer id) {
        Friend friend = friendMapper.selectById(id);
            friend.setAuditStatus(2);
            friendMapper.updateById(friend);
        return ResponseResult.okResult("审核已通过");
    }

    @Override
    public ResponseResult auditFail(Integer id) {
        Friend friend = friendMapper.selectById(id);
            friend.setAuditStatus(3);
            friendMapper.updateById(friend);
        return ResponseResult.okResult("审核失败");
    }
}




